package model.pikeshitje;

import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Author: Kostika Gorica
 * User:   kosta
 * Date:   3/9/13
 * Time:   9:38 PM
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL)
@XmlRootElement(name = "shitje")
public class Shitje {
    private int id;
    private int operatorID;
    private int status;
    @XmlElement(nillable = true)
    private Date dataKrijimit;
    @XmlElement(nillable = true)
    private Date dataPerfundimit;
    @XmlElement(nillable = true)
    private Date dataPageses;
    private double shumaFatures;
    private double taksa;
    private int pikeshitjeID;
    @XmlElement(nillable = true)
    private String shenime;
    @XmlAnyElement(lax = true)
    @XmlElementRef(type = ShitjeDetail.class)
    @XmlElementWrapper
    private List<ShitjeDetail> detailList;

    public Shitje(){
        this(0,0,0,null,null,null,0.0,0.0,0,"");
    }

    public Shitje(int id, int operatorID, int status, Date dataKrijimit, Date dataPerfundimit, Date dataPageses, double shumaFatures, double taksa, int pikeshitjeID, String shenime) {
        this.id = id;
        this.operatorID = operatorID;
        this.status = status;
        this.dataKrijimit = dataKrijimit;
        this.dataPerfundimit = dataPerfundimit;
        this.dataPageses = dataPageses;
        this.shumaFatures = shumaFatures;
        this.taksa = taksa;
        this.pikeshitjeID = pikeshitjeID;
        this.shenime = shenime;
        this.detailList = new ArrayList<ShitjeDetail>();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getOperatorID() {
        return operatorID;
    }

    public void setOperatorID(int operatorID) {
        this.operatorID = operatorID;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getDataKrijimit() {
        return dataKrijimit;
    }

    public void setDataKrijimit(Date dataKrijimit) {
        this.dataKrijimit = dataKrijimit;
    }

    public Date getDataPerfundimit() {
        return dataPerfundimit;
    }

    public void setDataPerfundimit(Date dataPerfundimit) {
        this.dataPerfundimit = dataPerfundimit;
    }

    public Date getDataPageses() {
        return dataPageses;
    }

    public void setDataPageses(Date dataPageses) {
        this.dataPageses = dataPageses;
    }

    public double getShumaFatures() {
        return shumaFatures;
    }

    public void setShumaFatures(double shumaFatures) {
        this.shumaFatures = shumaFatures;
    }

    public double getTaksa() {
        return taksa;
    }

    public void setTaksa(double taksa) {
        this.taksa = taksa;
    }

    public int getPikeshitjeID() {
        return pikeshitjeID;
    }

    public void setPikeshitjeID(int pikeshitjeID) {
        this.pikeshitjeID = pikeshitjeID;
    }

    public String getShenime() {
        return shenime;
    }

    public void setShenime(String shenime) {
        this.shenime = shenime;
    }

    public List<ShitjeDetail> getDetailList() {
        return detailList;
    }

    public void setDetailList(List<ShitjeDetail> detailList) {
        this.detailList = detailList;
    }

    public void addDetail(ShitjeDetail detail){
        this.detailList.add(detail);
    }
}
